package priv.yiyuan.example.design.proxy;

/**
 * 实际订单处理器
 * <p>
 * 代理模式-真实主题
 *
 * @author YiYuan
 * @data 2025/9/26
 * @apoNote
 */
public class RealOrderProcessor implements OrderProcessor {

    private OrderApprovalHandler chainStart;

    public RealOrderProcessor(OrderApprovalHandler chainStart) {
        this.chainStart = chainStart;
    }

    @Override
    public void processOrder(Order order) {
        System.out.println("\n[真实订单处理器] 订单ID: " + order.getOrderId() + " 进入审批流程。");

        if (chainStart != null) {
            chainStart.handleRequest(order);
        }
        else {
            System.out.println("[真实订单处理器] 错误: 审批链未设置。");
        }
        System.out.println("[真实订单处理器] 订单ID: " + order.getOrderId() + " 审批流程结束。");
    }
}
